<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>案件数据分析管理系统</title>
    <meta name="keywords" content="案件数据分析管理系统" />
    <meta name="description" content="案件数据分析管理系统" />
    <link rel="shortcut icon" href="favicon.ico" />

    <!-- 引入公共css -->
    <#include "/inc/header.ftl"/>
</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name"> <span style="visibility: hidden">1</span></h1>

        </div>
        <h2 style="font-size: 40px;width:800px;margin-left:-251px">案件数据分析管理系统</h2>

        <form class="m-t" role="form" id="loginForm">
            <div class="form-group">
                <input  class="form-control" placeholder="用户名" value="" id="username">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" value="" placeholder="密码" id="password">
            </div>
            <button type="button" class="btn btn-primary block full-width m-b" id="commit">登 录</button>
        </form>
    </div>
</div>
<!-- 引入公共js -->
<#include "/inc/footer.ftl"/>
</body>


<script>
    $(function(){
        $('#commit').click(function(){
            if (!$("#username").val()){
                swal({title: "请填写用户名称", text: "", type: "warning", confirmButtonText: '确认', timer: 1500});
                return;
            }
            if (!$("#password").val()){
                swal({title: "请填写登录密码", text: "", type: "warning", confirmButtonText: '确认', timer: 1500});
                return;
            }

            var data = {
                "username" : $("#username").val(),
                "password" : $("#password").val()
            }
            $.ajax({
                contentType: 'application/json;charset=utf-8', //设置请求头信息
                url: '/login',
                type: 'POST',
                data: JSON.stringify(data),//数据，这里使用的是Json格式进行传输
                dataType: 'JSON',
                success: function (result) {
                    if(result.status=="200"){
                        window.location.href="/index";
                    }else{
                        swal({title: "用户名或密码不正确", text: "", type: "warning", confirmButtonText: '确认', timer: 1500});
                    }
                }
            });

        })
        $('#loginForm').keydown(function(){
            if (event.keyCode == 13){
                event.returnValue=false;
                event.cancel = true;
                $('#commit').click();
            }
        });
    });





</script>

</html>
